package pl.perseus.action;

import lombok.Getter;
import lombok.Setter;

import org.springframework.beans.factory.annotation.Autowired;

import pl.perseus.model.StudentClasses;
import pl.perseus.service.student.IStudentService;
import pl.perseus.service.studentclasses.IStudentClassesService;

public class AssignStudentToClassesAction extends BaseAction {

	@Autowired
	IStudentClassesService studentClassesService;
	
	@Getter
	@Setter
	StudentClasses studentClasses;
	
	@Override
	public String execute() {
		studentClasses.setActive(true);
		studentClassesService.insertStudentClasses(studentClasses);
		
		logAction("Assigning student " + studentClasses.getId_student() + " to classes: " + studentClasses.getId_classes());
		
		return SUCCESS;
	}

}
